{extend name='index/index' /}

{block name='main'}
<style>

    #vip + div .am-selected-list li{
        display: none;
    }
    #vip + div .am-selected-list li:first-child{
        display: block;
    }
</style>
<link rel="stylesheet" href="https://cdn.bootcss.com/bootstrap/3.3.7/css/bootstrap.min.css" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous">
<script src="https://cdn.bootcss.com/bootstrap/3.3.7/js/bootstrap.min.js" integrity="sha384-Tc5IQib027qvyjSMfHjOMaLkfuWVxZxUPnCJA7l2mCWNIpG9mGCD8wGNIcPD7Txa" crossorigin="anonymous"></script>
<div id="tpl-echarts"></div>
<div class="tpl-content-wrapper">


    <div class="row-content am-cf">

        <div class="row">

            <div class="am-u-sm-12 am-u-md-12 am-u-lg-12">
                <div class="widget am-cf">
                    <div class="widget-head am-cf">
                        <div class="widget-title am-fl">交易记录</div>
                        <div class="widget-function am-fr">
                            <a href="javascript:;" class="am-icon-cog"></a>
                        </div>
                    </div>
                    <form class="am-form tpl-form-border-form tpl-form-border-br" style="line-height: 40px" action="{:url('vip_agent/Agent/showlist')}">
                        <span style="text-align:right;display: inline-block;width: 100px;margin-left: 4px">子账号：</span><input style="width: 200px;display: inline-block" type="text" value="{$get.zzh}" name="zzh">
                        <span style="text-align:right;display: inline-block;width: 100px;margin-left: 4px">合约：</span><input style="width: 200px;display: inline-block" type="text" value="{$get.hy}" name="hy">
                        <br>
                        <span style="text-align:right;display: inline-block;width: 100px;margin-left: 4px">开始日期：</span><input style="width: 200px;display: inline-block" name="start" value="{$get.start}" type="date">
                        <span style="text-align:right;display: inline-block;width: 100px;margin-left: 4px">结束日期：</span><input style="width: 200px;display: inline-block" name="end" value="{$get.end}" type="date">
                        <br>
                        <span style="text-align:right;display: inline-block;width: 100px">买卖：</span>
                        <select  name="mm"  data-am-selected="{searchBox: 1}" style="display: none;">
                            <option  value="买,卖" >所有</option>
                            <option  value="买" {if condition="$get.mm == '买'"} selected{/if}>买</option>
                            <option  value="卖" {if condition="$get.mm == '卖'"} selected{/if}>卖</option>
                        </select>
                        <span style="text-align:right;display: inline-block;width: 100px">开平：</span>
                        <select  name="kp"  data-am-selected="{searchBox: 1}" style="display: none;">
                            <option  value="开,平,平今" >所有</option>
                            <option  value="开" {if condition="$get.kp == '开'"} selected{/if}>开</option>
                            <option  value="平" {if condition="$get.kp == '平'"} selected{/if}>平</option>
                            <option  value="平今" {if condition="$get.kp == '平今'"} selected{/if}>平今</option>
                        </select>
                        <br>
                        <span style="text-align:right;display: inline-block;width: 150px"></span>
                        <button class="am-btn am-btn-primary tpl-btn-bg-color-success ">查找</button>
                    </form>


                    <div class="widget-body  widget-body-lg am-fr">

                        <table width="100%" class="am-table am-table-compact am-table-striped tpl-table-black " id="">
                            <thead>
                            <tr>
                                <th>id</th>
                                <th>子账号</th>
                                <th>所属分组</th>
                                <th>交易日</th>
                                <th>合约</th>
                                <th>买卖</th>
                                <th>开平</th>
                                <th>成交价</th>
                                <th>成交量</th>
                                <th>成交金额</th>
                                <th>手续费</th>
                                <th>平仓浮动盈亏</th>
                                <th>平仓盈亏</th>
                                <th>基础手续费</th>
                                <th>操作</th>
                            </tr>
                            </thead>
                            <tbody>
                            {volist name='list' id='user'}

                            <tr class="even gradeC">
                                <td>{$user.Id}</td>
                                <td>{$user.Subaccount}</td>
                                <td>{$user.Grouping}</td>
                                <td>{$user.TradingDday}</td>
                                <td>{$user.Contract}</td>
                                <td>{$user.Business}</td>
                                <td>{$user.Kaiping}</td>
                                <td>{$user.Price}</td>
                                <td>{$user.Count}</td>
                                <td>{$user.Amount}</td>
                                <td>{$user.Poundage}</td>
                                <td>{$user.Float}</td>
                                <td>{$user.Profit}</td>
                                <td>{$user.Brokerage}</td>
                                <td>
                                    <a data-toggle="modal" data-target="#myModal1" onclick="rz({$user.Id})">查看详情</a>
                                </td>
                            </tr>
                            {/volist}
                            <tr class="even gradeC" style="color: red;">
                                <td>总计</td>
                                <td>-</td>
                                <td>-</td>
                                <td>-</td>
                                <td>-</td>
                                <td>-</td>
                                <td>-</td>
                                <td>-</td>
                                <td>{$count.Count}</td>
                                <td>-</td>
                                <td>{$count.Poundage}</td>
                                <td>{$count.Float}</td>
                                <td>{$count.Profit}</td>
                                <td>{:number_format($count.Brokerage,2)}</td>
                                <td>-</td>
                            </tr>
                            <!-- more data -->
                            </tbody>
                        </table>

                        {$page}
                    </div>
                </div>
            </div>

            <div class="modal fade" id="myModal1" tabindex="-1" role="dialog" style="margin-top: 15%;" aria-labelledby="myModalLabel">
                <div class="modal-dialog" role="document">
                    <div class="modal-content">
                        <div class="modal-header">
                            <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
                            <h4 class="modal-title" id="name">详情：</h4>
                        </div>
                        <div class="modal-body" style="line-height: 30px;">
                            子账号：<a id="zzh">11</a>&nbsp;&nbsp;&nbsp;&nbsp;
                            所属分组：<a id="ssfz">11</a>&nbsp;&nbsp;&nbsp;&nbsp;
                            <br>
                            交易日：<a id="jyr">11</a>&nbsp;&nbsp;&nbsp;&nbsp;
                            <br>
                            委托号：<a id="wth">11</a>&nbsp;&nbsp;&nbsp;&nbsp;
                            成交号：<a id="cjh">11</a>&nbsp;&nbsp;&nbsp;&nbsp;
                            请求号：<a id="qqh">11</a>&nbsp;&nbsp;&nbsp;&nbsp;
                            <br>
                            交易所：<a id="jys">11</a>&nbsp;&nbsp;&nbsp;&nbsp;
                            合约：<a id="hy">11</a>&nbsp;&nbsp;&nbsp;&nbsp;
                            <br>
                            买卖：<a id="mm">11</a>&nbsp;&nbsp;&nbsp;&nbsp;
                            开平：<a id="kp">11</a>&nbsp;&nbsp;&nbsp;&nbsp;
                            投保：<a id="tb">11</a>&nbsp;&nbsp;&nbsp;&nbsp;
                            <br>
                            成交价：<a id="cjj">11</a>&nbsp;&nbsp;&nbsp;&nbsp;
                            成交量：<a id="cjl">11</a>&nbsp;&nbsp;&nbsp;&nbsp;
                            成交金额：<a id="cjje">11</a>&nbsp;&nbsp;&nbsp;&nbsp;
                            <br>
                            实际日期：<a id="sjrq">11</a>&nbsp;&nbsp;&nbsp;&nbsp;
                            成交时间：<a id="cjsj">11</a>&nbsp;&nbsp;&nbsp;&nbsp;
                            <br>
                            系统号：<a id="xth">11</a>&nbsp;&nbsp;&nbsp;&nbsp;
                            <br>
                            手续费：<a id="sxf">11</a>&nbsp;&nbsp;&nbsp;&nbsp;
                            平仓浮动盈亏：<a id="pcfdyk">11</a>&nbsp;&nbsp;&nbsp;&nbsp;
                            平仓盈亏：<a id="pcyk">11</a>&nbsp;&nbsp;&nbsp;&nbsp;
                            <br>
                            基础手续费：<a id="jcsxf">11</a>&nbsp;&nbsp;&nbsp;&nbsp;
                        </div>
                        <div class="modal-footer">
                            <button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>
                        </div>
                    </div>
                </div>
            </div>




        </div>

    </div>
</div>
<script>

    $('#vip').change(function () {
        $vipid=$(this).val();
        $.ajax({
            type:'get',
            url:'/admin_platform/User/selectagent?id='+$vipid,
            dataType:'json',
            success:function (data) {
                console.log(data);
                $('#agent').empty();
                $obj='<option value="0" >所有代理商</option>';
                for(var i in data){
                    $obj=$obj+'<option value="'+data[i].id+'" >'+data[i].name+'</option>';
                }
                $('#agent').append($obj);
            },
            error:function () {
                console.log('ajax操作失败');
            }
        })
    })


    function rz($uid) {
        $.ajax({
            type:'get',
            url:'/vip_agent/Vip/xq',
            dataType:'json',
            data:{'id':$uid},
            success:function (data) {
                console.log(data);
                $('#name').html('ID '+'<a>'+data.Id+'</a>'+' 的详情：')
                $('#zzh').html(data.Subaccount);
                $('#ssfz').html(data.Grouping);
                $('#jyr').html(data.TradingDday);
                $('#wth').html(data.Entrustment);
                $('#cjh').html(data.Deal);
                $('#qqh').html(data.Request);
                $('#jys').html(data.Exchange);
                $('#hy').html(data.Contract);
                $('#mm').html(data.Business);
                $('#kp').html(data.Kaiping);
                $('#tb').html(data.Insure);
                $('#cjj').html(data.Price);
                $('#cjl').html(data.Count);
                $('#cjje').html(data.Amount);
                $('#sjrq').html(data.Date);
                $('#cjsj').html(data.Time);
                $('#xth').html(data.System);
                $('#sxf').html(data.Poundage);
                $('#pcfdyk').html(data.Float);
                $('#pcyk').html(data.Profit);
                $('#jcsxf').html(data.Brokerage);
            },
            error:function () {
                console.log('ajax操作失败');
            }
        })
    }



</script>
{/block}

